package sql;

import java.util.List;

import org.junit.Test;

import sql.record.Course;
import sql.record.CourseSchedule;


public class WebTesting {

	@Test
	public void testGetAllRecord() {
		
		// getting a list of courses
		Course courseSearchBy = new Course();
		List<Course> records = null;
		try {
			records = DBManagment.getTable(courseSearchBy);
		} catch (Exception e) {
			// trying again 
			try {
				records = DBManagment.getTable(courseSearchBy);
			} catch (Exception retry) {
				// TODO decide what to do
			}
		}
		
		// if all succeeded we continue to get the hours
		for(Course course:records) {
			
			CourseSchedule scheduleSearchBy = new CourseSchedule();
			scheduleSearchBy.courseName = course.courseName;
			@SuppressWarnings("unused")
			List<CourseSchedule> schedule = null;
			try {
				schedule = DBManagment.getRecord(scheduleSearchBy);
			} catch (Exception e) {
				// trying again
				try {
					schedule = DBManagment.getRecord(scheduleSearchBy);
				} catch (Exception retry) {
					// TODO decide what to do
				}
			}
			// writing to the page
		}
		
	}
}
